﻿<!--#include file="const.inc"-->
<%
'====================================================================
' 感谢使用晴天3G智能建站系统..
' 作者:梁永强.QQ:766750857
' 官方网址:wap.qt3g.com
' 声明:软件版权归作者所有,没有经过作者本人同意不得非法破解和传播本程序
'====================================================================
%>
<%
        Action=Request.QueryString("Action")
        urls=Request.QueryString("urls")
        if urls="" then urls="index.asp"
        if Action="" then Action="pay4"
        qingtian.info

if sid<>"Null" then
select case v
case "0" 
we0="<br/>"
hr="-------------------<br/>"
book1="<input name='fansid' format='*N' size='15' maxlength='50'/><br/><anchor>[确认提交]<go href='znaonao.asp?Action=pay1&amp;sid="&sidd&"' method='post'><postfield name=""fansid"" value=""$(fansid:n)"" /></go></anchor><br/>"
title="<card title=""挠挠TA""><p align="""&qingtian.px&""">"
case "1"
zi="<span style=""color:#FF5500"">"
zi1="<span style=""color:#00FF00"">"
zi2="<span style=""color:#00FFFF"">"
zi0="</span>"
we="<div class=""footer"">"
sou="<div class=""block4"">"
dao="<div class=""navi"">"
we0="</div>"
we1="</div>"
book1=""&dao&"<form action=""znaonao.asp?Action=pay1&amp;sid="&sidd&""" method=""post""><input type=""text"" name=""fansid"" value="""" format=""*N"" size=""15"" maxlength=""200""/><br/><input type=""submit"" value=""确认提交""/></form>"&we0&""
title="<title>挠挠TA</title></head><body>"
End Select		
select case Action
case "pay4"
    		Page = Request("page")      '当前页数
    		If Page = "" Then Page = 1
   		If Not IsNumeric(Page) Then Page = 1
    		Page = CLng(Page)
    		If Page < 1 Then Page = 1
%>
<%=title%><%=qingtian.qingsav("310")%>
<%=dao%><a href="space.asp?sid=<%=sidd%>">我的空间</a>&gt;挠一下Ta<%=we0%><%=sou%>+请选择好友<%=we0%><%=we%><%=hr%>
<%
	Set Rs = Server.CreateObject("Adodb.Recordset")

	Sql = "select  a.id,a.fansid,b.name,b.online from qingtian_fans a,qingtian_user b  where a.fansid=b.id and a.nid=(select top 1 id from qingtian_user where sid='"&qingtian.Formatsid(sid)&"') order by b.online  desc"
	Rs.Open Sql,conn,1,1


	if not (rs.bof and rs.eof)  then
				Rs.PageSize = 6	'一页N条记录
				IF Not IsEmpty(Page) Then
					IF Not IsNumeric(Page) Then		'判断Page是否为数字
						Page=1
					Else
						Page=Cint(Page)		'转换成短整形Integer
					End IF
					IF Page > Rs.PageCount Then
						Rs.AbsolutePage = Rs.PageCount	'设置当前显示页等于最后一页
					ElseIF Page <= 0 Then
						Rs.AbsolutePage = 1		'设置当前页等于第一页
					Else
						Rs.AbsolutePage = Page	'如果大于零,显示当前页等于接收的页数
					End IF
				Else
					Rs.AbsolutePage = 1
				End IF
				Page = Rs.AbsolutePage
		For i=1 to Rs.PageSize
			If Rs.Eof Then
				exit For
			End If
		if rs("online")=0 then
onlin="不在线"
else
onlin="在线"
end if
%>
[<%=onlin%>]<a href="znaonao.asp?Action=pay1&amp;fansid=<%=rs("fansid")%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>"><%=qingtian.utf8(rs("name"))%>(<%=rs("fansid")%>)</a><br/>
<%
		Rs.MoveNext
		Next
Response.Write we1
if rs.PageCount >1 then Response.Write(""&dao&"")
       
    		'分页
    		If Page < rs.PageCount Then
    		    Response.Write("<a href='znaonao.asp?page=" & Page + 1 & "&amp;sid="&sidd&"&amp;urls=" & urls & "'>下一页</a>")
    		End If
       
    		If Page > 1 And Page < rs.PageCount Then
    		    Response.Write("|")
    		End If
        
    		If Page > 1 Then
    		    Response.Write("<a href='znaonao.asp?page=" & Page - 1 & "&amp;sid="&sidd&"&amp;urls=" & urls & "'>上一页</a>"&we0&"")
    		Elseif rs.PageCount >1 then
    		    Response.Write(""&we0&"")
                    Response.Write(""&sou&"(第" & Page & "/总" & rs.PageCount & "页/" & rs.RecordCount & "条)"&we0&"")
    		End If
	else
		%>你还没有添加任何好友<%=we0%><%
	end if
	Rs.close
	set rs=nothing


		%>

<%=sou%>+或输入会员ID<%=we0%>
<%=book1%><%=qingtian.qingsav("311")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay1"
        fansid=Request("fansid")
	if fansid="" then fansid=1
	if not isnumeric(fansid) then fansid=1
	fansid=clng(fansid)
name2=qingtian.name(fansid)
if fansid=qingtian.nid or name2="出错" then 
Response.Write title
qingtian.err("本系统不准许自己挠挠自己")
end if
%>
<%=title%><%=qingtian.qingsav("310")%>
<%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;挠挠<%=we0%><%=sou%>选个动作给<%=name2%><%=we0%><%=dao%>==普通挠挠==<%=we0%><%=we%>
<%
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql1 = "select top 22 [id],[name] from [qingtian_znaonao] where [money]=0 order by [id] asc"
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                   For i=1 to rs.RecordCount
                  %>
<a href="znaonao.asp?Action=pay2&amp;fansid=<%=fansid%>&amp;nid=<%=rs("id")%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>"><%=qingtian.utf8(rs("name"))%></a>.
<%                      
                    Rs.MoveNext
			next
%>
<a href="bnaonao.asp?Act=1&amp;fansid=<%=fansid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">>更多</a><%=we0%>
<% 
                else
%>
暂无挠挠<%=we0%>
<%              

			end if
			Rs.close
                  %>
<%=dao%>==耍酷挠挠==<%=we0%><%=we%>
<%
Sql1 = "select top 15 [id],[name],[money] from [qingtian_znaonao] where [money]>0 order by [id] asc"
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                   For i=1 to rs.RecordCount
%>
<a href="znaonao.asp?Action=pay2&amp;fansid=<%=fansid%>&amp;nid=<%=rs("id")%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>"><%=qingtian.utf8(rs("name"))%>(<%=zi%><%=qingtian.utf8(rs("money"))%><%=zi0%>)</a>.
<%                      
                    Rs.MoveNext
			next
%>
<a href="bnaonao.asp?Act=2&amp;fansid=<%=fansid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">&gt;更多</a><%=we0%>
<%                   
                else
%>
暂无挠挠<%=we0%>
<%              

			end if
			Rs.close
                        set rs=nothing
                  %><%=qingtian.qingsav("311")%>
<%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%

case "pay2"
        fansid=Request.QueryString("fansid")
	if fansid="" then fansid=1
	if not isnumeric(fansid) then fansid=1
	fansid=clng(fansid)
        nid=Request.QueryString("nid")
	if nid="" then nid=1
	if not isnumeric(nid) then nid=1
	nid=clng(nid)
if fansid=qingtian.nid then 
Response.Write title
qingtian.err("本系统不准许自己挠挠自己")
end if
Session.Abandon
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql2 = "select [name] from [qingtian_user] where [id]="&fansid
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                name2=rs("name")
			end if
			Rs.close
Sql1 = "select top 1 [nei],[name],[money] from [qingtian_znaonao] where [id]="&nid&" order by [id] asc"
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                nei=rs("nei")
                namee=rs("name")
                moneyt=rs("money")
		end if
		Rs.close
                set rs=nothing
name=session("username")
nei=Replace(nei, "A", ""&name&"")
nei=Replace(nei, "B", ""&name2&"")
if moneyt>0 then
took="<b>注:此动作将花去"&moneyt&""&qingtian.bi&".</b><br/>"
end if
%>
<%=title%><%=qingtian.qingsav("310")%><%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;挠挠<%=we0%>
<%=sou%><b><%=zi%>系统提示<%=zi0%>:</b><%=we0%><%=we%>你对<%=name2%>做了个动作:<br/><%=zi1%><%=namee%><%=zi0%><%=we0%><%=sou%>Ta会收到:<%=we0%><%=we%><%=zi2%><%=nei%><%=zi1%><br/><%=took%><a href="znaonao.asp?Action=pay3&amp;fansid=<%=fansid%>&amp;nid=<%=nid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">好的,就这样!</a><br/><a href="znaonao.asp?Action=pay1&amp;fansid=<%=fansid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">换个动作再挠!</a>
<%=we0%><%=qingtian.qingsav("311")%><%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<%
case "pay3"
        fansid=Request.QueryString("fansid")
	if fansid="" then fansid=1
	if not isnumeric(fansid) then fansid=1
	fansid=clng(fansid)
        nid=Request.QueryString("nid")
	if nid="" then nid=1
	if not isnumeric(nid) then nid=1
	nid=clng(nid)
if fansid=qingtian.nid then 
Response.Write title
qingtian.err("本系统不准许自己挠挠自己")
end if
Set Rs = Server.CreateObject("Adodb.Recordset")
Sql2 = "select [name] from [qingtian_user] where [id]="&fansid
		Rs.Open Sql2,conn,1,1
		if not (rs.bof and rs.eof) then
                name2=rs("name")
			end if
			Rs.close
Sql1 = "select top 1 [nei],[name],[money] from [qingtian_znaonao] where [id]="&nid&" order by [id] asc"
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                nei=rs("nei")
                namee=rs("name")
                moneyt=rs("money")
		end if
		Rs.close
Sql1 = "select top 1 [id],[name],[money] from [qingtian_user] where sid='"&qingtian.Formatsid(sid)&"' order by [id] asc"
		Rs.Open Sql1,conn,1,1
		if not (rs.bof and rs.eof) then
                tid=rs("id")
                name=rs("name")
                money=rs("money")
		end if
		Rs.close
                set rs=nothing
if session("tr")=1 then
Response.Redirect "/user/znaonao.asp?Action=pay2&fansid=" & fansid & "&nid=" & nid & "&sid="&sidd&""
end if
if moneyt>0 then
if clng(money)>=clng(moneyt) then
conn.execute("update qingtian_user set [money]=[money]-"&moneyt&" where sid='"&qingtian.Formatsid(sid)&"'")
Set Rs_1 = Server.CreateObject("Adodb.Recordset")
Sql_1 = "select [namea],[aid],[nameb],[bid],[bnei] from [qingtian_naonao]"
		Rs_1.Open Sql_1,conn,1,3
			rs_1.addnew
			rs_1("namea")=name2
			rs_1("aid")=fansid
			rs_1("nameb")=name
			rs_1("bid")=tid
			rs_1("bnei")=nei
			rs_1.update
		Rs_1.close
             set Rs_1=nothing
took=""&sou&"<b>提示</b>"&we0&""&we&"<b>真酷,你对"&name2&"做了个动作"&zi1&""&namee&""&zi0&"!</b><br/>(系统自动扣除你"&moneyt&""&qingtian.bi&")"
qingtian.addong("对[url=/user/spacev.asp?nid="&fansid&"&sid=[sid]]"&name2&"[/url]做了个动作[url=/user/znaonao.asp?sid=[sid]]"&namee&"[/url]")
str=""&fansid&"tt你好,你的朋友(url=/user/spacev.asp?nid="&qingtian.nid&"&urls=/user/ininfo.asp&sid=[sid])"&name&"(/url)对你做了个挠挠动作:"&namee&"![(url=/user/znaonao.asp?Action=pay1&fansid=" & qingtian.nid & "&sid=[sid])回挠(/url)]"
qingtian.addnfo(str)
session("tr")=1
else
took=""&sou&"<b>提示</b>"&we0&""&we&"<b>你的"&qingtian.bi&"不足,不能挠挠!</b>"
end if
else
took=""&sou&"<b>提示</b>"&we0&""&we&"<b>真酷,你对"&name2&"做了个动作"&zi1&""&namee&""&zi0&"!</b>"
qingtian.addong("对[url=/user/spacev.asp?nid="&fansid&"&sid=[sid]]"&name2&"[/url]做了个动作[url=/user/znaonao.asp?&sid=[sid]]"&namee&"[/url]")
str=""&fansid&"tt你好,你的朋友(url=/user/spacev.asp?nid="&qingtian.nid&"&urls=/user/ininfo.asp&sid=[sid])"&name&"(/url)对你做了个挠挠动作:"&namee&"![(url=/user/znaonao.asp?Action=pay1&fansid=" & qingtian.nid & "&sid=[sid])回挠(/url)]"
qingtian.addnfo(str)
Set Rs_1 = Server.CreateObject("Adodb.Recordset")
Sql_1 = "select [namea],[aid],[nameb],[bid],[bnei] from [qingtian_naonao]"
		Rs_1.Open Sql_1,conn,1,3
			rs_1.addnew
			rs_1("namea")=name2
			rs_1("aid")=fansid
			rs_1("nameb")=name
			rs_1("bid")=tid
			rs_1("bnei")=nei
			rs_1.update
		Rs_1.close
             set Rs_1=nothing
session("tr")=1
end if
%>
<%=title%><%=qingtian.qingsav("310")%><%=dao%><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>"><%=name2%>的空间</a>&gt;挠挠<%=we0%><%=took%><br/><a href="znaonao.asp?Action=pay1&amp;fansid=<%=fansid%>&amp;sid=<%=sidd%>&amp;urls=<%=urls%>">换个动作继续挠!</a><br/><a href="spacev.asp?nid=<%=fansid%>&amp;sid=<%=sidd%>">进入<%=name2%>的空间</a>
<%=we0%><%=qingtian.qingsav("311")%><%=hr%>
<%=sou%><a href="fans.asp?sid=<%=sidd%>">我的好友</a>|<a href="shangchen.asp?sid=<%=sidd%>">商场</a>|<a href="chuwu.asp?sid=<%=sidd%>">储物箱</a><%=we0%>
<% 

End Select
else
Response.Redirect "/login.asp?sid=" & sidd & "&url=/user/znaonao.asp?sid="&sidd
end if		
end Function
%>
